import request from '@/utils/request'


// 查询用户信息
export const getUserPageListApi = (page, limit, usernames) => {
  return request.get(`/admin/acl/user/${page}/${limit}`, {
    params: usernames
  })
}


// 添加用户信息
export const saveUserApi = (users) => {
  return request.post(`/admin/acl/user/save`, users)
}


// 修改用户信息
export const updateUserApi = (users) => {
  return request.put(`/admin/acl/user/update`, users)
}


// 根据id删除单个用户信息
export const removeUserApi = (id) => {
  return request.delete(`/admin/acl/user/remove/${id}`)
}



// 根据id列表进行批量删除
export const deletesUserApi = (ids) => {
  return request.delete(`/admin/acl/user/batchRemove`, {
    data: ids
  })
}


// 根据用户获取角色数据
export const getRoleList = adminId => {
  return request.get(`/admin/acl/user/toAssign/${adminId}`);
};
// 根据用户分配角色
export const doAssign = (adminid, assignList) => {
  return request.post(
    `/admin/acl/user/doAssign/`,
    {},
    {
      params: {
        userId: adminid,
        roleId: assignList.join()
      }
    }
  );
};

